var contentAddEditor;
$(function() {
			contentAddEditor = ABCFUNTION
					.createEditor("#contentAddForm [name=content]");
			ABCFUNTION.initOnePicUpload();
			$("#contentAddForm [name=categoryId]")
					.val($("#contentCategoryTree").tree("getSelected").id);
		});

var contentAddPage = {
	submitForm : function() {
		if (!$('#contentAddForm').form('validate')) {
			$.messager.alert('提示', '表单还未填写完成!');
			return;
		}
		contentAddEditor.sync();

		/*
		 * $.post("/rest/content/save",$("#contentAddForm").serialize(),
		 * function(data){ if(data.status == 200){
		 * $.messager.alert('提示','新增内容成功!');
		 * $("#contentList").datagrid("reload");
		 * ABCFUNTION.closeCurrentWindow(); } });
		 */
		// 提交到后台的RESTful
		$.ajax({
					type : "POST",
					url : "/rest/content",
					data : $("#contentAddForm").serialize(),
					success : function(msg) {
						$.messager.alert('提示', '新增内容成功!');
						$("#contentList").datagrid("reload");
						ABCFUNTION.closeCurrentWindow();
					},
					error : function() {
						$.messager.alert('提示', '新增内容失败!');
					}
				});
	},
	clearForm : function() {
		$('#contentAddForm').form('reset');
		contentAddEditor.html('');
	}
};